package me.shiqiang.im.service;

import me.shiqiang.im.msg.SyncFriendResp;
import me.shiqiang.im.msg.SyncGroupReq;
import me.shiqiang.im.msg.SyncGroupResp;
import me.shiqiang.im.vo.Friend;
import me.shiqiang.im.vo.Group;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

import java.util.Collection;

/**
 * @author cuishiqiang
 * @date 2018/1/12 下午10:52
 */
@Service
public class OptService {

    @Autowired
    StringRedisTemplate redisTemplate;

    @Autowired
    UserService userService;


    public SyncFriendResp processFriendSyncReq(Long userId){
        Collection<Friend> friends = userService.getFriends(userId);
        SyncFriendResp resp = new SyncFriendResp();
        resp.setFriends(friends);
        resp.setUserId(userId);
        return resp;
    }

    public SyncGroupResp processGroupSyncReq(Long userId){
        Collection<Group> groups = userService.getGroups(userId);
        SyncGroupResp resp = new SyncGroupResp();
        resp.setGroups(groups);
        resp.setUserId(userId);
        return resp;
    }
}
